<template>
    <view>
        <slot v-if="$root.g0"></slot>
        <trees
            @__l="__l"
            class="_contain"
            :imgMode="imgMode"
            :loadVideo="loadVideo"
            :nodes="$root.g1 ? nodes : $root.g2 ? html : []"
            :style="'display:block;' + (selectable ? 'user-select:text;-webkit-user-select:text;' : '') + (showWithAnimation ? 'opacity:0;' + showAnimation : '')"
            vueId="116ecbda-1"
        ></trees>
    </view>
</template>

<script>
import trees from '@/components/jyf-Parser/trees';
import tabBar from '@/components/TabBar/tabBar';
(global.webpackJsonp = global.webpackJsonp || []).push([
    ['components/jyf-Parser/index'],
    {
        '4c68': function (t, e, n) {
            'use strict';

            (function (t, i) {
                var o = n('4ea4');
                Object.defineProperty(e, '__esModule', {
                    value: true
                });
                e.default = void 0;
                var r = o(n('7037'));
                var a = n('7974').parseHtmlSync;
                var s = (getApp().globalData.parserCache = {});
                var l = n('a72c');
                var c = n('ec6a');
                function d(t) {
                    if (0 != t.indexOf('http')) {
                        return t;
                    }
                    for (
                        e = '', n = 0, void 0;
                        n < t.length && ((e += Math.random() >= 0.5 ? t[n].toUpperCase() : t[n].toLowerCase()), '/' != t[n] || '/' == t[n - 1] || '/' == t[n + 1]);
                        n++
                    ) {
                        var e;
                        var n;
                    }
                    return (e += t.substring(n + 1));
                }
                var u = {
                    name: 'parser',
                    data: function () {
                        return {
                            showAnimation: '',
                            controls: {},
                            nodes: []
                        };
                    },
                    components: {
                        trees: function () {
                            n.e('components/jyf-Parser/trees')
                                .then(
                                    function () {
                                        return resolve(n('6943'));
                                    }.bind(null, n)
                                )
                                .catch(n.oe);
                        }
                    },
                    props: {
                        html: {
                            type: null,
                            default: null
                        },
                        autocopy: {
                            type: Boolean,
                            default: true
                        },
                        autopause: {
                            type: Boolean,
                            default: true
                        },
                        autopreview: {
                            type: Boolean,
                            default: true
                        },
                        autosetTitle: {
                            type: Boolean,
                            default: true
                        },
                        domain: {
                            type: String,
                            default: null
                        },
                        imgMode: {
                            type: String,
                            default: 'default'
                        },
                        lazyLoad: {
                            type: Boolean,
                            default: false
                        },
                        selectable: {
                            type: Boolean,
                            default: false
                        },
                        tagStyle: {
                            type: Object,
                            default: function () {
                                return {};
                            }
                        },
                        showWithAnimation: {
                            type: Boolean,
                            default: false
                        },
                        useAnchor: {
                            type: Boolean,
                            default: false
                        },
                        useCache: {
                            type: Boolean,
                            default: false
                        }
                    },
                    watch: {
                        html: function (t) {
                            this.setContent(t, void 0, true);
                        }
                    },
                    mounted: function () {
                        this.imgList = [];
                        this.imgList.each = function (t) {
                            for (var e = 0; e < this.length; e++) {
                                var n = t(this[e], e, this);
                                if (n) {
                                    this.includes(n) ? (this[e] = d(n)) : (this[e] = n);
                                }
                            }
                        };
                        this.setContent(this.html, void 0, true);
                    },
                    methods: {
                        setContent: function (e, n, o) {
                            var that = this;
                            if ('object' == (0, r.default)(n)) {
                                for (var h in n) {
                                    this[
                                        (h = h.replace(/-(\w)/g, function (t, e) {
                                            return e.toUpperCase();
                                        }))
                                    ] = n[h];
                                }
                            }
                            if (this.showWithAnimation) {
                                this.showAnimation =
                                    'transition:400ms ease 0ms;transition-property:transform,opacity;transform-origin:50% 50% 0;-webkit-transition:400ms ease 0ms;-webkit-transform:;-webkit-transition-property:transform,opacity;-webkit-transform-origin:50% 50% 0;opacity: 1';
                            }
                            if (e) {
                                if ('string' == typeof e) {
                                    if (this.useCache) {
                                        var f = (function (t) {
                                            for (e = t.length, n = 5381, void 0; e--; ) {
                                                var e;
                                                var n;
                                                n += (n << 5) + t.charCodeAt(e);
                                            }
                                            return n;
                                        })(e);
                                        s[f] ? (this.nodes = s[f]) : ((this.nodes = a(e, this)), (s[f] = this.nodes));
                                    } else {
                                        this.nodes = a(e, this);
                                    }
                                    this.$emit('parse', this.nodes);
                                } else if ('[object Array]' == Object.prototype.toString.call(e)) {
                                    this.nodes = o ? [] : e;
                                    if (e.length && 'Parser' != e[0].PoweredBy) {
                                        var m = {
                                            _imgNum: 0,
                                            _videoNum: 0,
                                            _audioNum: 0,
                                            _domain: this.domain,
                                            _protocol: this.domain ? (this.domain.includes('://') ? this.domain.split('://')[0] : 'http') : void 0,
                                            _STACK: [],
                                            CssHandler: new l(this.tagStyle)
                                        };
                                        m.CssHandler.getStyle('');
                                        (function t(e) {
                                            for (i = 0, void 0; (n = e[i++]); ) {
                                                var n;
                                                var i;
                                                if ('text' != n.type) {
                                                    for (var o in ((n.attrs = n.attrs || {}), n.attrs)) {
                                                        c.trustAttrs[o] ? 'string' != typeof n.attrs[o] && (n.attrs[o] = n.attrs[o].toString()) : (n.attrs[o] = void 0);
                                                    }
                                                    c.LabelAttrsHandler(n, m);
                                                    c.blockTags[n.name] ? (n.name = 'div') : c.trustTags[n.name] || (n.name = 'span');
                                                    n.children && n.children.length ? (m._STACK.push(n), t(n.children), m._STACK.pop()) : (n.children = void 0);
                                                }
                                            }
                                        })(e);
                                        this.nodes = e;
                                    }
                                } else {
                                    if ('object' != (0, r.default)(e) || !e.nodes) {
                                        return this.$emit('error', {
                                            source: 'parse',
                                            errMsg: '传入的nodes数组格式不正确！应该传入的类型是array，实际传入的类型是：' + (0, r.default)(e.nodes)
                                        });
                                    }
                                    this.nodes = e.nodes;
                                    console.warn('Parser 类型错误：object 类型已废弃，请直接将 html 设置为 object.nodes （array 类型）');
                                }
                            } else {
                                if (o) {
                                    return;
                                }
                                this.nodes = [];
                            }
                            this.$nextTick(function () {
                                that.imgList.length = 0;
                                that.videoContexts = [];
                                (function e(n) {
                                    for (
                                        o = function () {
                                            var o = n[r];
                                            if ('trees' == o.$options.name) {
                                                for (a = false, s = o.nodes.length; (l = o.nodes[--s]); ) {
                                                    l.c ||
                                                        ('img' == l.name
                                                            ? (l.attrs.src &&
                                                                  l.attrs.i &&
                                                                  (-1 == that.imgList.indexOf(l.attrs.src)
                                                                      ? (that.imgList[l.attrs.i] = l.attrs.src)
                                                                      : (that.imgList[l.attrs.i] = d(l.attrs.src))),
                                                              a ||
                                                                  ((a = true),
                                                                  that.lazyLoad && t.createIntersectionObserver
                                                                      ? (o._observer && o._observer.disconnect(),
                                                                        (o._observer = t.createIntersectionObserver(o)),
                                                                        o._observer
                                                                            .relativeToViewport({
                                                                                top: 1000,
                                                                                bottom: 1000
                                                                            })
                                                                            .observe('._img', function (t) {
                                                                                o.imgLoad = true;
                                                                                o._observer.disconnect();
                                                                                o._observer = null;
                                                                            }))
                                                                      : (o.imgLoad = true)))
                                                            : 'video' == l.name
                                                            ? (((c = t.createVideoContext(l.attrs.id, o)).id = l.attrs.id), that.videoContexts.push(c))
                                                            : 'audio' == l.name && l.attrs.autoplay
                                                            ? i.createAudioContext(l.attrs.id, o).play()
                                                            : 'title' == l.name &&
                                                              that.autosetTitle &&
                                                              'text' == l.children[0].type &&
                                                              l.children[0].text &&
                                                              t.setNavigationBarTitle({
                                                                  title: l.children[0].text
                                                              }));
                                                }
                                            }
                                            if (o.$children.length) {
                                                e(o.$children);
                                            }
                                        },
                                            r = n.length,
                                            void 0;
                                        r--;

                                    ) {
                                        var o;
                                        var r;
                                        var a;
                                        var s;
                                        var l;
                                        var c;
                                        o();
                                    }
                                })(that.$children);
                                t.createSelectorQuery()
                                    .in(that)
                                    .select('._contain')
                                    .boundingClientRect(function (t) {
                                        that.$emit('ready', t);
                                    })
                                    .exec();
                            });
                        },
                        getText: function () {
                            var t = !(arguments.length > 0 && void 0 !== arguments[0]) || arguments[0];
                            var e = '';
                            var n = function n(i) {
                                if ('text' == i.type) {
                                    return (e += i.text);
                                }
                                if (
                                    t &&
                                    ((('p' == i.name || 'div' == i.name || 'tr' == i.name || 'li' == i.name || /h[1-6]/.test(i.name)) && e && '\n' != e[e.length - 1]) ||
                                        'br' == i.name)
                                ) {
                                    e += '\n';
                                }
                                if (i.children) {
                                    for (var o = 0; o < i.children.length; o++) {
                                        n(i.children[o]);
                                    }
                                }
                                t && ('p' == i.name || 'div' == i.name || 'tr' == i.name || 'li' == i.name || /h[1-6]/.test(i.name)) && e && '\n' != e[e.length - 1]
                                    ? (e += '\n')
                                    : t && 'td' == i.name && (e += '\t');
                            };
                            if (this.nodes && this.nodes.length) {
                                var i = this.nodes;
                            } else {
                                if (this.html[0] && (this.html[0].name || this.html[0].type)) {
                                    var i = this.html;
                                } else {
                                    var i = [];
                                }
                            }
                            if (!i.length) {
                                return '';
                            }
                            for (var o = 0; o < this.html.length; o++) {
                                n(this.html[o]);
                            }
                            return e;
                        },
                        navigateTo: function (e) {
                            var that = this;
                            var i = function (i, o) {
                                var r = t.createSelectorQuery().in(o || that);
                                r.select(i).boundingClientRect();
                                r.selectViewport().scrollOffset();
                                r.exec(function (n) {
                                    if (!n || !n[0]) {
                                        return e.fail
                                            ? e.fail({
                                                  errMsg: 'Label Not Found'
                                              })
                                            : null;
                                    }
                                    t.pageScrollTo({
                                        scrollTop: n[1].scrollTop + n[0].top,
                                        success: e.success,
                                        fail: e.fail
                                    });
                                });
                            };
                            e.id ? i('._contain >>> #' + e.id + ', ._contain >>> .' + e.id) : i('._contain');
                        },
                        getVideoContext: function (t) {
                            if (!t) {
                                return this.videoContexts;
                            }
                            for (var e = this.videoContexts.length; e--; ) {
                                if (this.videoContexts[e].id == t) {
                                    return this.videoContexts[e];
                                }
                            }
                            return null;
                        }
                    }
                };
                e.default = u;
            }.call(this, n('543d').default, n('bc2e').default));
        },
        '83b0': function (t, e, n) {
            'use strict';

            n.r(e);
            var i = n('c1e1');
            var o = n('ed18');
            for (var r in o) {
                if (['default'].indexOf(r) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return o[t];
                        });
                    })(r);
                }
            }
            n('e833');
            var a = n('f0c5');
            var s = Object(a.a)(o.default, i.b, i.c, false, null, null, null, false, i.a, void 0);
            e.default = s.exports;
        },
        c1e1: function (t, e, n) {
            'use strict';

            n.d(e, 'b', function () {
                return i;
            });
            n.d(e, 'c', function () {
                return o;
            });
            n.d(e, 'a', function () {});
            var i = function () {
                var that = this;
                var e = (that.$createElement, that._self._c, !((that.html && that.html.length && (that.html[0].name || that.html[0].type)) || that.nodes.length));
                var n = that.nodes.length;
                var i = n ? null : that.html && that.html.length && (that.html[0].name || that.html[0].type);
                that.$mp.data = Object.assign(
                    {},
                    {
                        $root: {
                            g0: e,
                            g1: n,
                            g2: i
                        }
                    }
                );
            };
            var o = [];
        },
        d3c9: function (t, e, n) {},
        e833: function (t, e, n) {
            'use strict';

            var i = n('d3c9');
            n.n(i).a;
        },
        ed18: function (t, e, n) {
            'use strict';

            n.r(e);
            var i = n('4c68');
            var o = n.n(i);
            for (var r in i) {
                if (['default'].indexOf(r) < 0) {
                    (function (t) {
                        n.d(e, t, function () {
                            return i[t];
                        });
                    })(r);
                }
            }
            e.default = o.a;
        }
    }
]);
(global.webpackJsonp = global.webpackJsonp || []).push([
    'components/jyf-Parser/index-create-component',
    {
        'components/jyf-Parser/index-create-component': function (t, e, n) {
            n('543d').createComponent(n('83b0'));
        }
    },
    [['components/jyf-Parser/index-create-component']]
]);
</script>
<style>
@import './index.css';
</style>
